gamepad_set_button_threshold


描述

此函数可用于设置给定设备的模拟按钮的当前阈值设置。所有模拟按钮的默认阈值为 0.5,范围为 0 到 1。该阈值定义了按钮被视为对于要求它们充当数字按钮的游戏被 “按下” 的点。


语法:

gamepad_set_button_threshold(device, threshold);

参数 描述
device 要检查哪个游戏手柄设备 “插槽” 。
threshold 新阈值(从 0 到 1,默认为 0.5)。


返回:

N/A(无返回值)


例如:

if gamepad_get_button_threshold(0) != 0.5
   {
   gamepad_set_button_threshold(0, 0.5);
   }

上面的代码检查连接到设备 “slot” 0 的游戏手柄的模拟按钮阈值,如果它不是默认值 0.5,则将其设置为该值。